package com.mijie.homi.ns.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mijie.homi.common.domain.Notify;
import com.mijie.homi.common.domain.PushMessage;
import com.mijie.homi.ns.dao.NotifyDao;

@Service
public class NotifyService {

	@Autowired
	private NotifyDao dao;
	
	public int addNotify(Notify notify){
		return dao.addNotify(notify);
	}
	
	public int addToPushQueue(PushMessage message){
		if(message.getIdx()==0) message.setIdx(System.currentTimeMillis());
		if(message.getDestinationDeviceId()==null) message.setDestinationDeviceId("");
		return dao.addToPushQueue(message);
	}
}
